package com.slz3.business.module.wmsManagement.wmsPurchaseOrderThree.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.wmsManagement.wmsPurchaseOrderThree.domain.WmsPurchaseOrderThree;
import com.slz3.business.module.wmsManagement.wmsPurchaseOrderThree.domain.WmsPurchaseOrderThreeFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class WmsPurchaseOrderThreeTransactionalServiceImpl implements WmsPurchaseOrderThreeTransactionalService {

    @Override
    public WmsPurchaseOrderThree modify(WmsPurchaseOrderThree wmsPurchaseOrderThreeNew) {
        Repositorys.wmsPurchaseOrderThree.test();
        Repositorys.wmsPurchaseOrderThree.save(WmsPurchaseOrderThreeFactory.initBaseFields());
        System.err.println(1 / 0);
        wmsPurchaseOrderThreeNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.wmsPurchaseOrderThree.saveAndFlush(wmsPurchaseOrderThreeNew);
    }

    @Override
    public List<WmsPurchaseOrderThree> batchModify(List<WmsPurchaseOrderThree> wmsPurchaseOrderThreeList) {
        return Repositorys.wmsPurchaseOrderThree.saveAll(wmsPurchaseOrderThreeList);
    }
}
